<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Blog extends CI_Controller {
	protected  $language = 0;
	public function index($productid=0,$cateid=0)
	{
		$this->load->library('session');
		$this->load->library('parser');		
		$this->load->helper('language');
		$this->load->helper('url');
		$this->load->helper('xml'); 
		$data = array();
		$this->load->view('template/header',$data);
		$this->load->view('template/adventive',$data);
		$this->load->view('template/search',$data);
		$this->load->view('template/potsnews',$data);
		
		$this->load->model('news_model');
		$data['cateshow']=$this->news_model->cateshow(0);
		$data['catehide']=$this->news_model->catehide(0);
		$data['banner']=$this->news_model->banner();
		$data['newhot']=$this->news_model->newhot();
		$this->load->view('template/menuhome',$data);
		
		//title cate
		$parentcatename = $this->news_model->getparentcatename($cateid);
		$catename = $this->news_model->getcatename($cateid);		
		$data['catename']=$this->news_model->getcatename($cateid);
		$data['parentcatename']=$this->news_model->getparentcatename($cateid);
		$data['listcate']=$this->news_model->listcateid($cateid);
		$this->load->view('template/titlecate',$data);
		
		
		$this->load->view('template/catecontenttop',$data);
		//left menu
		$parentcateid = $this->news_model->getparentcateid($cateid);
		if($parentcateid<=0)
		{
			$parentcateid=$cateid;
		}
		if(strlen($parentcateid)<=0)
		{
			$parentcateid=$cateid;
		}
		$data['parentcateid']=$parentcateid;
		$data['cateid']=$cateid;
		$data['listcatep']=$this->news_model->getproductcate($parentcateid);
		$data['listproduct']=$this->news_model->getranking($parentcateid);
		$this->load->view('template/catecontentleft',$data);
		
		//load right content
		
		$this->load->view('template/closediv',$data);
		
		$this->parser->parse('template/footer', $data,false);
		
		
	}
	
}
